﻿using Microsoft.WowAddonStudio.Lua.Loaders;
using Microsoft.WowAddonStudio.Lua.Model;

using NUnit.Framework;

namespace Microsoft.WowAddonStudio.Lua.Tests.Loaders
{
    [TestFixture]
    public class FrameXmlFileDocumentationLoaderTest : FileDocumentationLoaderTestBase<FrameXmlFileDocumentationLoader>
    {
        [Test]
        public void WidgetDeclarationTest()
        {
            var documentationScope = FileDocumentationLoader.LoadFileDocumentation("../../../Data/FrameXML/BasicControls.xml");
            var scriptsErrorFrame = documentationScope.Resolve<Table>("ScriptErrors");

            Assert.IsNotNull(scriptsErrorFrame);
            Assert.AreEqual("Frame", scriptsErrorFrame.Prototype);
        }

        [Test]
        public void InlineScriptTest()
        {
            var documentationScope = FileDocumentationLoader.LoadFileDocumentation("../../../Data/FrameXML/BasicControls.xml");

            var messageFunction = documentationScope.Resolve<Function>("message");

            Assert.IsNotNull(messageFunction);
            Assert.AreEqual(1, messageFunction.Parameters.Length);
        }
    }
}
